﻿/*
打开系统菜单 的js代码
供 admin_index.aspx调用
*/
function doing(key) {
    if (key == "go_sys_index") {//系统首页
        mainwin_Open("Admin_Main.aspx?t=" + Math.random());
    }
    else if (key == "setting_panel") {//系统管理面板
        setmenutip('系统管理');
        OpenLeftMenu("setting_panel");
    }
    else if (key == "go_site_admin") {//站点管理
        setmenutip('站点管理');
        OpenLeftMenu("tree_panel&view=site&t=" + Math.random());
    }
    else if (key == "go_publish_admin") {//发布管理
        setmenutip('发布管理');
        OpenLeftMenu("tree_panel&view=publish&t=" + Math.random());
    }
    else if (key == "logout") {
        if (confirm('你确定要退出系统吗？')) {
            sp_isRefash = true;
            window.location.href = 'logout.aspx';
        }
    }
    else if (key == "setting") {//系统设置
        mainwin_Open("param/admin_setting.aspx?t=" + Math.random());
    }
    else if (key == "user_admin") {//用户管理
        mainwin_Open("adminuser/UserBase_list.aspx?t=" + Math.random());
    }
    else if (key == "content_model_admin") {//内容模型管理
        mainwin_Open("model/Model_list.aspx?t=" + Math.random());
    }
    else if (key == "psn_admin") {//发布点(PSN)管理
        mainwin_Open("param/PSN_list.aspx?t=" + Math.random());
    }
    else if (key == "plugin_admin") {//插件管理
        mainwin_Open("Plugin/Plugin_list.aspx?t=" + Math.random());
    }
    else if (key == "tpl_vars_admin") {//模板变量管理
        mainwin_Open("param/admin_setting.aspx?cid=2&t=" + Math.random());
    }
    else if (key == "keywords_admin") {//关键字替换
        mainwin_Open('param/WordReplace_list.aspx?t=' + Math.random());
    }
    else if (key == "userself_admin") {//个人信息修改
        mainwin_Open('adminuser/UserSelf_save.aspx?t=' + Math.random());
    }
    else if (key == "clear_cache") {//缓存清理
        mainwin_Open('param/CacheSetting.aspx?t=' + Math.random());
    }
    else if (key == "state") { //查看状态
        statewin_show();
    }
    else if (key.indexOf('plugin_') >= 0) { //通用插件
        var plugin_key = key.replace('plugin_', '');
        var returntext = $.ajax({ type: "POST", url: 'Plugin/Plugin_menu.aspx', data: 'ac=ajax_get_plugindata&key=' + plugin_key, async: false }).responseText;
        //alert(returntext);
        var msg = eval("msg=" + returntext);
        if (msg.result == "1") {
            setmenutip(msg.item[1]);
            var url = msg.item[3];
            if (url.indexOf('?') > 0) {
                url = url + '&t=' + Math.random();
            }
            else {
                url = url + '?t=' + Math.random();
            }
            mainwin_Open(url);
            OpenLeftMenu(key);
        }
        else {
            alert(msg.msg);
        }
    }
    else if (key == "fielddel_admin") {
        mainwin_Open('param/FieldSetting.aspx?t=' + Math.random());
    }
    else {
        alert(key);
    }
    $("#showmenu").hide();

}
function setmenutip(k) {
    var cookie = new CookieClass();
    cookie.setCookie('menutip', k);
    $("#menutip").html(k);
}
//打开左侧菜单
function OpenLeftMenu(parm) {
    var leftframe = $("#leftwin");
    var url = "LeftTree.aspx?time=" + Math.random() + "&menu=" + parm;
    leftframe.attr("src", url);
    var cookie = new CookieClass();
    cookie.setCookie('leftwin', url);
}
function OpenInMain(url) {
    mainwin_Open(url, 0);
}
function hideleft() {
    sp_isRefash = true;
    setLeftHide();
    setTimeout("sp_isRefash=false", 100);
}
function showleft() {
    sp_isRefash = true;
    setLeftShow();
    setTimeout("sp_isRefash=false", 100);
}
function DoingUndefinedMenu(_menuTip, _menuAction, _URL) {
    if (_menuTip != "") {
        setmenutip(_menuTip);
    }
    if (_menuAction != "") {
        OpenLeftMenu(_menuAction);
    }
    else {
        mainwin_Open(_URL + "?t=" + Math.random());
    }
}